/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.misena.praxispraktik.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author TADSI12
 */
@Entity
@Table(name = "aprendices")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Aprendices.findAll", query = "SELECT a FROM Aprendices a"),
    @NamedQuery(name = "Aprendices.findByIdAprendices", query = "SELECT a FROM Aprendices a WHERE a.idAprendices = :idAprendices")})
public class Aprendices implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idAprendices")
    private Integer idAprendices;
    @JoinColumn(name = "idPersonas", referencedColumnName = "idPersonas")
    @ManyToOne(optional = false)
    private Personas idPersonas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idAprendices")
    private Collection<Gruposaprendices> gruposaprendicesCollection;

    public Aprendices() {
    }

    public Aprendices(Integer idAprendices) {
        this.idAprendices = idAprendices;
    }

    public Integer getIdAprendices() {
        return idAprendices;
    }

    public void setIdAprendices(Integer idAprendices) {
        this.idAprendices = idAprendices;
    }

    public Personas getIdPersonas() {
        return idPersonas;
    }

    public void setIdPersonas(Personas idPersonas) {
        this.idPersonas = idPersonas;
    }

    @XmlTransient
    public Collection<Gruposaprendices> getGruposaprendicesCollection() {
        return gruposaprendicesCollection;
    }

    public void setGruposaprendicesCollection(Collection<Gruposaprendices> gruposaprendicesCollection) {
        this.gruposaprendicesCollection = gruposaprendicesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAprendices != null ? idAprendices.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aprendices)) {
            return false;
        }
        Aprendices other = (Aprendices) object;
        if ((this.idAprendices == null && other.idAprendices != null) || (this.idAprendices != null && !this.idAprendices.equals(other.idAprendices))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.misena.praxispraktik.entity.Aprendices[ idAprendices=" + idAprendices + " ]";
    }
    
}
